﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_category : System.Web.UI.Page
{
    protected Administrator admin;
    protected int SortID;
    private int guid;
    private Category cat;
    protected void Page_Load(object sender, EventArgs e)
    {
        admin = Administrator.Check();
        if (admin == null)
        {
            Session.Add(Params.SystemError, "请先登录");
            Response.Redirect(Params.RootHttp + "default.aspx");
        }
        this.guid = Convert.ToInt32(Request.Params["guid"]);
        this.cat = new Category(this.guid);
        if (!Page.IsPostBack)
        {
            this.MyDataBind();
        }
    }

    public void MyDataBind()
    {
        this.conNav.Title = "管理员-导师类型-" + this.cat.Name;
        this.Title = "管理员-导师类型-" + this.cat.Name;
        this.SortID = 1;
        //this.repCategory.DataSource = Category.CategorysDt();
        //this.repCategory.DataBind();
        this.tbName.Text = this.cat.Name;
        this.tbIntro.Text = this.cat.Intro;
        this.repDoctor.DataSource = this.cat.Doctors();
        this.repDoctor.DataBind();
    }

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string n = this.tbName.Text.Trim();
        string i = this.tbIntro.Text.Trim();
        if (n == "" || i == "")
        {
            this.info.SetMessage("类型名称和说明不能为空");
            return;
        }
        this.cat.Intro = i;
        this.cat.Name = n;
        this.cat.Update();
        Fun.Refresh("修改成功");
    }
}
